package com.dongjiantong.biz.serviceImpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongjiantong.biz.mapper.FarmStableRecordMapper;
import com.dongjiantong.biz.model.FarmStableRecord;
import com.dongjiantong.biz.service.FarmStableRecordService;
import com.dongjiantong.mybatis.ServiceMybatis;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by ThinkPad on 2018/1/9.
 */
@Slf4j
@Service(version = "1.0.0")
public class FarmStableRecordServiceImpl extends ServiceMybatis<FarmStableRecord> implements FarmStableRecordService {

    @Resource
    private FarmStableRecordMapper farmStableRecordMapper;

    @Override
    public PageInfo<FarmStableRecord> selectByPage(Integer pageNum, Integer pageSize, Long farmId) {
        if (pageNum==null){
            pageNum=1;
        }
        if (pageSize==null){
            pageSize=10;
        }
        FarmStableRecord farmStableRecord = new FarmStableRecord();
        farmStableRecord.setFarmId(farmId);
        PageHelper.startPage(pageNum,pageSize);
        return  new PageInfo<FarmStableRecord>(farmStableRecordMapper.select(farmStableRecord));
    }
}
